#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
    void * ptr;
    int len;

    len = 32;
    ptr = malloc(len);
    memset(ptr, 0x5a, len);
    *(unsigned int *)ptr = 0xffff0000 | 0x3cde;

    printf("*(unsigned short *)ptr = 0x%hx\n",
            *(unsigned short *)ptr); 

    printf("*(unsigned int   *)ptr = 0x%x\n",
            *(unsigned int *)ptr); 

    printf("(*(unsigned int *)ptr)>>16 = 0x%x\n",
            ((*(unsigned int *)ptr)>>16));

    if ((0xffff0000 | 0x3cde) == *(unsigned int *)ptr)
        printf("0xffff3cde\n");

    if (0xffff == (*(unsigned int *)ptr)>>16)
        printf("0xffff\n");

    if (0x3cde == *(unsigned short *)ptr)
        printf("0x3cde\n");

    return 0;
}
